<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登录</title>
<script src="${pageContext.request.contextPath}/static/js/jQuery.js"></script>
</head>
<body>
		<table>
			<tr>
				<h1>Java Web版本 辅导员管理平台v1.0</h1>
			</tr>
			<tr>
				<td>用户名:</td>
				<td>
					<input id="uname" type="text" name="id" placeholder="请输入用户名" />
				</td>
			</tr>
			<p></p>
			<tr>
				<td>密码：</td>
				<td>
					<input id="pwd" type="password" name="password" placeholder="请输入密码" />
				</td>
			</tr>
			<p></p>
			<tr>
				<td rowspan="2">
					<input type="submit" value="登录" onclick="Login();"/>
				</td>
				<td>
					<input type="button" value="注册" onclick="window.location.href='ViewRegisterServlet'" />
				</td>
			</tr>
		</table>
<script type="text/javascript">
	function Login() {
		var id=$('#id').val();
		var password=$('#pwd').val();
		$.ajax({
			url:'/Login',
			dataType:'json',
			data:{'id':id,'password':password},
			type:'post',
			success:function(data){
				if(data.code(0)){
					alert("登录成功");
				}else{
					alert("登录失败");
				}
			}
		});
	}
</script>
</body>
</html>